//导入路由模块
import { createRouter, createWebHistory } from 'vue-router'
//导入单文件组件（页面）
import HomeView from '../views/HomeView.vue'

//创建路由
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),//使用模式
  //配置路由
  routes: [
    {
      path: '/',//路径
      name: 'home',//路由名称
      component: HomeView//组件
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')//路由的懒加载，只有访问的时候才会加载
    }
  ]
})

export default router
